﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.SqlClient;
namespace DoAnOOP.DataAccessLayer
{
    class clsKetQua_SinhVien
    {
        public DataRow GetDiem()
        {
            string sql = "SELECT KETQUA.MAMONHOC AS [Mã Môn Học], KETQUA.DIEMGIUAKY AS [Điểm Giữa kì],KETQUA.DIEMTHUCHANH AS [Điểm Thực hành],KETQUA.DIEMCUOIKY AS [Điểm Cuối kì] FROM KETQUA,MONHOC,LYLICH,KHOA WHERE KETQUA.MAMONHOC = MONHOC.MAMONHOC AND KETQUA.MSSV = LYLICH.MSSV AND KHOA.MAKHOA = LYLICH.MAKHOA AND KETQUA.MSSV = '" + frmMain.mssv + "'";
            SqlDataAdapter da = new SqlDataAdapter(sql, clsConnect.GetSqlConnect());
            DataSet ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count != 0)
            {
                DataRow dr = ds.Tables[0].Rows[0];
                return dr;
            }
            else
            {
                return null;
            }
        }
        public DataRow GetKhoa()
        {
            string sql = "SELECT KHOA.TENKHOA FROM LYLICH, KHOA WHERE LYLICH.MAKHOA = KHOA.MAKHOA AND LYLICH.MSSV = '" + frmMain.mssv + "'";
            SqlDataAdapter da = new SqlDataAdapter(sql, clsConnect.GetSqlConnect());
            DataSet ds = new DataSet();
            da.Fill(ds);
            if (ds.Tables[0].Rows.Count!=0)
            {
                DataRow dr = ds.Tables[0].Rows[0];
                return dr;
            }
            else
            {
                return null;
            }
            

        }
        



    }
}
